<?php
$hostname = "localhost";
$username = "root";
$password = "debi";

try {
	$db = new PDO("mysql:host=$hostname;dbname=zoo", $username, $password);
	echo "connected to database<br>";
} catch(PDOException $e){
	echo $e->get_message();
	die();
}

$count = $db->exec("INSERT INTO animals(animal_type, animal_name) VALUES ('kiwi', 'troy')");
echo "$count<br>";

$sql_select = "select * from animals";
$statement = $db->query($sql_select);

$result = $statement->fetch(PDO::FETCH_ASSOC);
foreach($result as $key => $value){
	print "$key => $value<br>";
}

$result = $db->query("update animals set animal_type = 'kakaktua' where animal_name = 'troy'");
echo $result;

$db = null;

?>